# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>

pkgname=srt
pkgver=1.5.3
pkgrel=1
pkgdesc="Secure Reliable Transport library"
url="https://www.srtalliance.org/"
arch=(loong64 x86_64)
license=(MPL2)
depends=(
  gcc-libs
  openssl
)
makedepends=(
  cmake
  git
  ninja
)
_commit=09f35c0f1743e23f514cb41444504a7faeacf89e  # tags/v1.5.3
source=("git+https://github.com/Haivision/srt#commit=$_commit")
b2sums=('SKIP')

pkgver() {
  cd srt
  git describe --tags | sed 's/^v//;s/[^-]*-g/r&/;s/-/+/g'
}

prepare() {
  cd srt
}

build() {
  local cmake_options=(
    -DCMAKE_INSTALL_PREFIX=/usr
    -DCMAKE_BUILD_TYPE=None
    -DENABLE_STATIC=ON
    -DENABLE_TESTING=ON
  )

  cmake -S srt -B build -G Ninja "${cmake_options[@]}"
  cmake --build build
}

check() {
  cd build
  ./uriparser-test
  ./utility-test
}

package() {
  DESTDIR="$pkgdir" cmake --install build
}

# vim:set sw=2 sts=-1 et:
